package com.woniuxy.businessassembly.service.impl;

import com.woniuxy.businessassembly.model.HotelSettle;
import com.woniuxy.businessassembly.dao.HotelSettleMapper;
import com.woniuxy.businessassembly.service.IHotelSettleService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Kevin Kwok
 * @since 2021-05-24
 */
@Service
public class HotelSettleServiceImpl extends ServiceImpl<HotelSettleMapper, HotelSettle> implements IHotelSettleService {
    @Resource
    private HotelSettleMapper settleMapper;
    @Override
    public int newBusiness(HotelSettle settle) {
        int i = settleMapper.newBusiness(settle);
        return i;
    }

    @Override
    public int checkBusiness(String hotelName) {
        /*查询指定酒店的所有的申请信息*/
        HotelSettle hotelSettle = settleMapper.queryCheckInfo(hotelName);
        if(hotelSettle.getStatus()==0){
            /*修改酒店的审核状态*/
            int i = settleMapper.modifyCheckStatus(hotelName);
            return i;
        }
        return 0;
    }
}
